Fix: Fix expanding project from the ui by adding new features#114
Fix: Fix expanding project from the ui by adding new features#114ipodishima wants to merge 2 commits intoAutoForgeAI:masterfrom
Conversation
📝 WalkthroughWalkthroughAdds MCP (Feature MCP) integration to run feature_create_bulk via Claude SDK, tracks MCP tool results to emit features_created events, and retains an XML Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Claude SDK Client
participant MCP as MCP Server
participant Service as expand_chat_session
participant Parser as XML Parser
participant Features as Feature Service
Client->>MCP: invoke feature_create_bulk tool
alt MCP returns successful ToolResult
MCP-->>Client: ToolResult (created IDs)
Client->>Service: yield ToolResult block
Service->>Service: mark mcp_tool_succeeded = true
Service->>Features: record feature IDs & counts
Service-->>Client: emit features_created (source: "mcp")
else MCP fails or unavailable
MCP-->>Client: failure/unavailable
Client->>Service: continue processing (mcp_tool_succeeded = false)
Service->>Parser: find <features_to_create> XML block
Parser-->>Service: extracted feature objects
Service->>Features: call _create_features_bulk
Service-->>Client: emit features_created (source: "xml_parsing")
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@server/services/expand_chat_session.py`:
- Around line 346-375: The code that processes MCP tool results assumes every
dict in created_features has an "id" key, which can raise an uncaught KeyError;
update the handling in the ToolResult branch (the block that builds
created_features, self.features_created, and self.created_feature_ids) to safely
extract ids (e.g., use f.get("id") or filter only items where "id" in f), only
extend self.created_feature_ids with valid ids, and adjust the increment to
reflect the number of successfully extracted ids; additionally either broaden
the except clause to include KeyError or validate before accessing keys so no
KeyError is thrown (refer to variables created_features, self.features_created,
self.created_feature_ids and the ToolResult parsing block to locate the change).
…/autocoder PR AutoForgeAI#114 - Fix: Fix expanding project from UI by adding new features - Added MCP tool success detection to skip XML fallback when tool succeeds - Added more Feature MCP tools to allowed list - Added XML fallback documentation in expand-project.md PR AutoForgeAI#115 - Fix latest build issues from master - Added npm dependency staleness check in start_ui.py - Added 'types': ['node'] to tsconfig.node.json
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@server/services/expand_chat_session.py`:
- Around line 346-379: The ToolResult detection is wrong: replace the type check
string "ToolResult" with "ToolResultBlock" and stop reading a non-existent
tool_name on the result block; instead use block.tool_use_id to find the
corresponding ToolUseBlock (the previously tracked ToolUseBlock that stores the
tool's name, e.g., where you recorded tool calls) and compare that
ToolUseBlock.name to "feature_create_bulk". Update the branch that currently
uses getattr(block, "tool_name", "") to look up the ToolUseBlock by tool_use_id,
set mcp_tool_succeeded when the matched ToolUseBlock.name contains
"feature_create_bulk", and then proceed to parse block.content as before while
still updating self.features_created, self.created_feature_ids and logging with
self.project_name.
🧹 Nitpick comments (1)
server/services/expand_chat_session.py (1)
408-426: Consider adding the same "id" safety filter for consistency.Line 415 uses
[f["id"] for f in created]without the safety filter applied in the MCP path (line 364). While_create_features_bulkguarantees "id" keys in returned dicts, adding the same defensive filter would improve consistency and protect against future changes.♻️ Suggested fix for defensive consistency
if created: - self.features_created += len(created) - self.created_feature_ids.extend([f["id"] for f in created]) + valid_ids = [f["id"] for f in created if "id" in f] + self.features_created += len(valid_ids) + self.created_feature_ids.extend(valid_ids)
…ure AutoForgeAI#114 - Verified TestStep8HarnessKernelExecution class with 3 test methods - All 3 tests pass: kernel creates run, budget tracker tracks turns, kernel records started event - Marked feature AutoForgeAI#114 as passing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…/autocoder PR AutoForgeAI#114 - Fix: Fix expanding project from UI by adding new features - Added MCP tool success detection to skip XML fallback when tool succeeds - Added more Feature MCP tools to allowed list - Added XML fallback documentation in expand-project.md PR AutoForgeAI#115 - Fix latest build issues from master - Added npm dependency staleness check in start_ui.py - Added 'types': ['node'] to tsconfig.node.json
|
This might be already merged right @leonvanzyl? |
The add new features from the UI sparkle icon wasn't working due to lack of permissions
Summary by CodeRabbit
New Features
Improvements
Behavior
✏️ Tip: You can customize this high-level summary in your review settings.